<template>
    <van-nav-bar title="购物车" left-text="返回" right-text="清空" left-arrow @click-left="onClickLeft"
        @click-right="onClickRight" />
</template>
<script setup lang="ts">
import { showToast, showConfirmDialog } from 'vant';
import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia'
import { useCart } from '../stores/carts'
const store = useCart()
const router = useRouter()
const {  } = storeToRefs(store)
const onClickLeft = () => router.push({name:'home'});
const onClickRight = () => {
    showConfirmDialog({
        title: '标题',
        message:
            '如果解决方法是丑陋的，那就肯定还有更好的解决方法，只是还没有发现而已。',
    })
    .then(() => {
        store.feachcartRemoveall()
        
    })
    .catch(() => {
        console.log(2);
        
    });

    
}
</script>